<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.0/css/jquery.dataTables.css"></link>

<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>

<script type="text/javascript" language="javascript">
jQuery.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
{
    var nodes;
    var display = jQuery('tbody tr', settings.nTable);
 
    if ( jQuery.fn.dataTable.versionCheck ) {
        // DataTables 1.10
        var api = new jQuery.fn.dataTable.Api( settings );
        nodes = api.rows().nodes().toArray();
    }
    else {
        // 1.9-
        nodes = this.oApi._fnGetTrNodes( settings );
    }
 
    /* Remove nodes which are being displayed */
    for ( var i=0 ; i<display.length ; i++ ) {
        var iIndex = jQuery.inArray( display[i], nodes );
 
        if ( iIndex != -1 ) {
            nodes.splice( iIndex, 1 );
        }
    }
 
    return nodes;
};

$(document).ready(function() {
	oTable = $('#product_table').dataTable({
        "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]]
    });
	    
	   $('form').submit(function(){
	      $(oTable.fnGetHiddenNodes()).find('input:text').appendTo(this);
	      $(oTable.fnGetHiddenNodes()).find('select').appendTo(this);
	   });
	} );
	</script>
</head>
<body>
<h1>Item Clearance List </h1>

<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">

<table width = "1200" border="1" cellspacing="1" cellpadding="5" id="product_table" >
<thead> 
  <tr>
		<th>Barcode</th>
		<th>Description</th>
		<th>W1(Latest)</th>
		<th>W2</th>
		<th>W3</th>
		<th>W4</th>
		<th>W5</th>
		<th>W6</th>
		<th>W7</th>
		<th>W8(Oldest)</th>
		<th>WH Stock</th>
		<th>SHOP Stock</th>
		<th>Order/Category</th>
	</tr>
 </thead> 	
 <tbody>
			<?php foreach($this->newItemList as $k => $v){?>
	<tr>
		<td width = "70"><?php echo $v['product_code']?></td>
		<td width = "450"><?php echo $v['description']?></td>
		<?php if($v['w1'] != 'Null'){?>
		<td align = "center"><?php echo $v['w1']?></td>
		<td align = "center"><?php echo $v['w2']?></td>
		<td align = "center"><?php echo $v['w3']?></td>
		<td align = "center"><?php echo $v['w4']?></td>
		<td align = "center"><?php echo $v['w5']?></td>
		<td align = "center"><?php echo $v['w6']?></td>
		<td align = "center"><?php echo $v['w7']?></td>
		<td align = "center"><?php echo $v['w8']?></td>
		<?php }else{ ?>
		<td align = "center" colspan = "8"><?php echo 'Null'?></td>
		<?php }?>
		<td><?php echo $v['wh_stock']?></td>
		<td><?php echo $v['stock_shop']?></td>
		<td width = "70"><input type = "text" name = "order[<?php echo $v['product_id']?>]" value = "0" size = "5"></input>
		<select name = "category[<?php echo $v['product_id']?>]">
			<option selected="selected"  value = "U">U</option>
			<option value = "VU">VU</option>
		</select></td>
	</tr>
	<?php }?>
 
  </tbody>
  
</table>
<br/>
<br/>
<input type = "submit" name = "next" id = "next" value = "Order&Next" style = "margin-left:750px;"></input>
</form>
</body>
</html>
